package com.wlw.web;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;    

import com.wlw.entity.City;
import com.wlw.entity.Province;
import com.wlw.service.ProvinceService;

import edu.xjsoft.base.orm.support.PropertyFilter;
@Controller
@RequestMapping("/province/*")
public class ProvinceAction {
	@Autowired
	private ProvinceService provinceService;
	
	//省份详情页
	@RequestMapping("provinceDetail")
	public String provinceDetail(HttpServletRequest req,Model model){
		int id = Integer.parseInt(req.getParameter("id"));
		PropertyFilter filters = new PropertyFilter("id", id);
		List<Province> provinces = provinceService.search(filters);
		model.addAttribute("provinces", provinces);
		return "foreground/provinceDetail";
	}
	//查询当地省份：
	@RequestMapping("localProvince")
	public String localProvince(HttpServletRequest req,Model model){
		String localPro = req.getParameter("localP");
		PropertyFilter filters = new PropertyFilter("name",localPro);
		List<Province> provinces = provinceService.search(filters);
		model.addAttribute("provinces", provinces);
		return "foreground/provinceDetail";
	}
	
}
